package model

import (
	"gorm.io/gorm"
	"time"
)

type Order struct {
	Id         uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	UserId     uint           `gorm:"column:user_id;type:bigint(20) UNSIGNED;comment:用户id;not null;default:0;" json:"user_id"`   // 用户id
	HouseId    uint           `gorm:"column:house_id;type:bigint(20) UNSIGNED;comment:房源id;not null;default:0;" json:"house_id"` // 房源id
	Price      uint           `gorm:"column:price;type:int(10) UNSIGNED;not null;default:0;" json:"price"`
	PictureUrl string         `gorm:"column:picture_url;type:varchar(255);comment:首付款凭证;not null;" json:"picture_url"`                                      // 首付款凭证
	Status     uint           `gorm:"column:status;type:bigint(20) UNSIGNED;comment:状态: 1:锁定中 2:待审核 3:签约 4:尾款 5:过户 6:完成;not null;default:1;" json:"status"` // 状态: 1:锁定中 2:待审核 3:签约 4:尾款 5:过户 6:完成
	CreatedAt  time.Time      `gorm:"column:created_at;type:datetime(3);not null;" json:"created_at"`
	UpdatedAt  time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt  gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (o *Order) TableName() string {
	return "order"
}
